import React,{ Component } from 'react'
import { connect } from 'react-redux'
import { Box } from 'react-desktop/macOs'

class UserInfo extends Component {
  render(){
    return (
      <div>
      <Box label="用户" padding="10px 30px"><ul>
      <li>ID：{this.props.home.uid} </li>
      <li>用户名:{this.props.home.username} </li>
      <li>令牌：{this.props.home.token}</li>
      </ul></Box>
      <Box label="网盘" padding="10px 30px"><ul>
      <li>网盘容量：{(this.props.disk.used/1048576).toFixed(2)}mb/{(this.props.disk.quota/1048576).toFixed(2)}mb </li>
      </ul></Box>
      </div>
    )
  }
}

const mapStateToProps = (state) => {
  return {
    home: state.home,
    disk: state.disk
  }
}

export default connect(mapStateToProps)(UserInfo)
